// components/doctor-card/doctor-card.js
import { navigateTo } from "../../utils/util.js";
let app = getApp()

Component({
  /**
   * 组件的属性列表
   */
  properties: {
    doctorsData: {
      type: Object,
      default: {}
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    hosName: app.globalData.ENVIRONMENT_CONFIG.hosName,
    needPay: app.globalData.ENVIRONMENT_CONFIG.needPay
  },

  /**
   * 组件的方法列表
   */
  methods: {
    goDoctorDetail() {
      let doctorId = this.data.doctorsData.DoctorID || this.data.doctorsData.doctorId
      let deptId = this.data.doctorsData.ClinicID || ''
      let deptType = this.data.doctorsData.DeptType || ''
      let schedulingId = this.data.doctorsData.SchedulingID || ''
      let chargeRegisterAll = this.properties.doctorsData.ChargeRegisterAll || ''
      navigateTo({
        url: "/pages/home/doctorDetail/doctorDetail?" + "DoctorId=" + doctorId + "&deptId=" + deptId + "&deptType=" + deptType + "&SchedulingID=" + schedulingId + '&chargeRegisterAll=' + chargeRegisterAll
      });
    },
    imgerror(e){
      this.setData({
        ['doctorsData.logo']: '/images/doctor-icon.png'
      });
    }
  },
  ready: function() {

  }
})